package ie.timalb.chess.main.core.grid;

import java.util.LinkedList;
import java.util.List;

public class GridDimensions{
	private int xDimension;
	private int yDimension;
	private List <CellLocation> locations;
	
	public GridDimensions(int xDimension, int yDimension) {
		setXDimension(xDimension);
		setYDimension(yDimension);
		initializeDimensions (xDimension, yDimension);
	}
	
	private void initializeDimensions(int xDimension, int yDimension) {
		setLocations(new LinkedList<CellLocation>());
		
		for (int currX=0; currX<=xDimension; currX++){
			for (int currY=0; currY<=xDimension; currY++){
				getLocations().add(new CellLocation (currX, currY));
			}
		}		
	}

	public int getXDimension() {
		return xDimension;
	}
	private void setXDimension(int dimension) {
		xDimension = dimension;
	}
	public int getYDimension() {
		return yDimension;
	}
	private void setYDimension(int dimension) {
		yDimension = dimension;
	}

	public CellLocation getFirstLocation() {
		return getLocations().get(0);
	}

	public CellLocation getLastLocation() {
		return getLocations().get(getLocations().size());
	}

	private List<CellLocation> getLocations() {
		return locations;
	}

	private void setLocations(List<CellLocation> locations) {
		this.locations = locations;
	}
	
	
}
